﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using TeamReview.Services;

namespace TeamReview
{
    public class CreateReviewRequestWIModel : IDataErrorInfo
    {
        private event PropertyChangedEventHandler PropertyChanged;
        private QueryBindingItem _queryFrom = null;
        private QueryBindingItem _linkTo = null;
        private string _title = string.Empty;
        private string _priority = string.Empty;
        private string _codeType = string.Empty;
        private string _description = string.Empty;
        private string _suggestedDescription = string.Empty;
        private string _codeSnippet = string.Empty;

        public QueryBindingItem QueryFrom
        {
            get
            {
                return _queryFrom;
            }
            set
            {
                _queryFrom = value;
                this.NotifyPropertyChanged("QueryFrom");

            }
        }
        public QueryBindingItem LinkTo
        {
            get
            {
                return _linkTo;
            }
            set
            {
                _linkTo = value;
                this.NotifyPropertyChanged("LinkTo");
            }
        }
        public string AssignTo { get; set; }
        public string Title
        {
            get
            {
                return _title;
            }
            set
            {
                // once we have CodeSelection details available, this property will be 
                // CodeSelection FileName, StartLine, EndLine
                Title = value;
                this.NotifyPropertyChanged("Title");
            }
        }
        public string Priority
        {
            get
            {
                return _priority;
            }
            set
            {
                _priority = value;
                this.NotifyPropertyChanged("Priority");
            }
        }
        public string CodeType
        {
            get
            {
                return _codeType;
            }
            set
            {
                _codeType = value;
                this.NotifyPropertyChanged("CodeType");

            }
        }

        public string Description
        {
            get
            {
                return _description;
            }
            set
            {
                _description = value;
                this.NotifyPropertyChanged("Description");
            }
        }
        public string SuggestedSolution
        {
            get
            {
                return _suggestedDescription;
            }
            set
            {
                _suggestedDescription = value;
                this.NotifyPropertyChanged("SuggestedSolution");
            }
        }

        public string CodeSnippet
        {
            get
            {
                return _codeSnippet;
            }
            set
            {
                _codeSnippet = value;
                this.NotifyPropertyChanged("CodeSnippet");
            }
        }


        public string Error
        {
            get { return null; }
        }

        public string this[string columnName]
        {
            get
            {
                string sResult = string.Empty;
                return sResult;
            }
        }
        protected void NotifyPropertyChanged([CallerMemberName]string propertyName ="")
        {
            if (this.PropertyChanged != null)
            {
                this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
